begintownscript;

variables;
short bmessage,pcs,leadchar,new_x,new_y,old_x,old_y,rctx;

body;

beginstate 0;

	force_view_center(47,47);
	reset_dialog();
	add_dialog_str(0,"THANK YOU for playing IMAGINE THIS SCENARIO.",0);
	add_dialog_str(1,"Do NOT play this scenario if you want to use your Party in other scenarios because you will not be able to.  This is your last chance to duck out if you think the going's too hot.",0);
	add_dialog_choice(0,"I'm with you, Brother.");
	add_dialog_choice(1,"Things are a bit shaky.");
	bmessage = run_dialog(0);
	if(bmessage == 2)
		end_scenario(2);

	leadchar = 0;
	while(char_ok(leadchar) == FALSE){
		leadchar = (leadchar + 1);
	}
	pcs = (leadchar + 1);
	while(pcs <= 3){
		rctx = 0;
		while(rctx <= 12){
			destroy_char_item(pcs,rctx);

			rctx = (rctx + 1);
		}
		while(item_type_in_slot(pcs,13) != -1){
			destroy_char_item(pcs,13);
		}
		erase_char(pcs);
		pcs = (pcs + 1);
	}
	set_name(leadchar,"Child");
	relocate_character(leadchar,21,23);
	force_view_center(21,23);
	force_instant_terrain_redraw();
	reset_dialog();
	add_dialog_str(0,"You are the CHILD.  You are a typical Child and like to play with your little Brothers and Sisters.  You will eventually grow ^UP^ to be the Revolutionary for our Nation but you must first Survive and Thrive before you can Rebel.",0);
	add_dialog_str(1,"This is the Family.  Some families are Supportive.  That is good.",0);
	add_dialog_choice(0,". . .");
	bmessage = run_dialog(0);

break;

beginstate 1;
break;

beginstate START_STATE;

	leadchar = 0;
	while(char_ok(leadchar) == FALSE){
		leadchar = (leadchar + 1);
	}

	if(is_combat() == 1){
		message_dialog("No fighting in The House.","Spanking.");
		end_scenario(0);
	}

		leadchar = 0;
		while(char_ok(leadchar) == FALSE){
			leadchar = (leadchar + 1);
		}
		new_x = char_loc_x(leadchar);
		new_y = char_loc_y(leadchar);

		if(((new_x != old_x) || (new_y != old_y)) && (is_combat() == 0)){
			set_terrain(old_x,old_y,467);

			if((new_x <= old_x) && (new_y < old_y))
				set_terrain(new_x,new_y,480);
			if((new_x < old_x) && (new_y >= old_y))
			set_terrain(new_x,new_y,481);
			if((new_x >= old_x) && (new_y > old_y))
				set_terrain(new_x,new_y,482);
			if((new_x > old_x) && (new_y <= old_y))
				set_terrain(new_x,new_y,483);
		}

		old_x = new_x;
		old_y = new_y;

	if((get_flag(1,0) < 2) && (char_loc_y(leadchar) <= 18)){
		message_dialog("This is your Teddy Bear.  It is a way to escape from the fucking pigs.  They can think you are asleep and you can talk to it.  It is a very good brother to you.","");
		set_flag(1,0,2);
	}

	if(get_flag(1,0) < 3){
		if(has_item(483) == TRUE){
			take_item(483);
//			set_terrain(22,16,0);
//			set_terrain(23,16,0);
//			set_terrain(21,17,0);
//			set_terrain(22,17,0);
//			set_terrain(23,17,0);
//			set_terrain(24,17,0);
//			set_terrain(25,17,0);
//			set_terrain(22,18,0);
//			set_terrain(23,18,0);
//			set_terrain(24,18,0);
//			set_terrain(25,18,0);
			force_instant_terrain_redraw();
//			pause(5);
			reset_dialog();
			add_dialog_str(0,"With your teddy bear brother, you can grow strong.  Get big some day and take out those fucking pigs.",0);
			add_dialog_choice(0,"Right on.");
			bmessage = run_dialog(0);
			set_flag(1,0,3);
		}
	}

break;

beginstate 10;

	message_dialog("Your are a stubby little dude and your legs cannot get you on top of the chair yet.","");
	block_entry(1);

break;

beginstate 11;

	set_terrain(21,25,10);
	force_instant_terrain_redraw();
	play_sound(59);
	pause(5);

	reset_dialog();
	add_dialog_str(0,"Your family is not supportive.",0);
	add_dialog_str(1," ",0);
	add_dialog_str(2,"This is bad.",0);
	add_dialog_choice(0,". . .");
	bmessage = run_dialog(0);

	reset_dialog();
	block_entry(1);
	set_flag(1,0,1);

break;

beginstate 12;

	if(get_flag(1,0) == 0){
		message_dialog("Your room is for sleep.  Nature is a lot more interesting and so are your brothers and sisters.","");
		block_entry(1);
	}
	if(has_item(483) == TRUE)
		block_entry(1);

break;

beginstate 13;

	if(get_flag(1,0) >= 2){
		block_entry(1);
	}

break;

beginstate 14;

	if(get_flag(1,0) >= 3)
		move_to_new_town(1,34,49);

break;

beginstate 15;

	message_dialog("This is where the 'rents keep the clothes.  You can't mess with them or else they'll wallop you but good.","");

break;

